{load header}
<!--/H-->

<!-- 内容区 -->
<div id="main-content">
    <div id="top-alert" class="fixed alert alert-error" style="display: none;">
        <button class="close fixed" style="margin-top: 4px;">&times;</button>
        <div class="alert-content">这是内容</div>
    </div>
    <div id="main" class="main">



        <div class="main-title">
            <h2>热点资讯管理</h2>
        </div>
        <!-- nav -->
        <ul class="tab-nav nav">
            <li class="current"><a href="{eval echo site_url('community/information')}">资讯列表</a></li>
            <li><a href="{eval echo site_url('community/information_add')}">添加资讯</a></li>
        </ul>
        <!-- nav -->
        <div class="cf">
            <!--排序-->
            【
            <a {if $order_name== 'recommend'}class="btn"{/if} href="{eval echo
            site_url('community/information')}?order=recommend&rec_order={if
            $rec_order_val}{$rec_order_val}{else}desc{/if}">推荐</a>
            <a {if $order_name== 'show'}class="btn"{/if} href="{eval echo
            site_url('community/information')}?order=show&show_order={if
            $show_order_val}{$show_order_val}{else}desc{/if}">显示</a>
            <a {if $order_name== 'sort'}class="btn"{/if} href="{eval echo
            site_url('community/information')}?order=sort&sort_order={if
            $sort_order_val}{$sort_order_val}{else}desc{/if}">排序</a>
            <a {if $order_name== 'readnum'}class="btn"{/if} href="{eval echo
            site_url('community/information')}?order=readnum&read_order={if
            $read_order_val}{$read_order_val}{else}desc{/if}">阅读数</a>
            <a {if $order_name== 'answernum'}class="btn"{/if} href="{eval echo
            site_url('community/information')}?order=answernum&answer_order={if
            $answer_order_val}{$answer_order_val}{else}desc{/if}">回答数</a>
            <a {if $order_name== 'likes'}class="btn"{/if} href="{eval echo
            site_url('community/information')}?order=likes&likes_order={if
            $likes_order_val}{$likes_order_val}{else}desc{/if}">喜欢数</a>
            <a {if $order_name== 'focusnum'}class="btn"{/if} href="{eval echo
            site_url('community/information')}?order=focusnum&focus_order={if
            $focus_order_val}{$focus_order_val}{else}desc{/if}">关注数</a>
            】
            <!-- 高级搜索 -->
            <div class="search-form fr cf">
                <div class="sleft">
                    <div class="drop-down drop-award">
                        <span id="sch-sort-txt-award" class="sort-txt"
                              data="{if $seach_type}{$seach_type}{else}title{/if}">{if $seach_type_name}{$seach_type_name}{else}资讯标题{/if}</span>
                        <i class="arrow arrow-down"></i>
                        <ul id="sub-sch-menu-award" class="nav-list hidden">
                            <li><a href="javascript:;" value="title">资讯标题</a></li>
                            <li><a href="javascript:;" value="tag">资讯标签</a></li>
                            <li><a href="javascript:;" value="name">用户名</a></li>
                            <li><a href="javascript:;" value="nick">用户昵称</a></li>
                        </ul>
                    </div>
                    <input type="text" name="q" class="search-input" value="{$keyword}" placeholder="请输入关键字"/>
                    <a class="sch-btn" href="javascript:;" id="search" url=""><i class="btn-search"></i></a>
                </div>
            </div>
        </div>
        <div class="tab-wrap">

            <div class="tab-content">

                <!-- 数据列表 -->
                <div class="data-table table-striped">
                    <table>
                        <thead>
                        <tr>
                            <th>排序</th>
                            <th style="width: 460px;">资讯标题</th>
                            <th style="width: 120px;">作者</th>
                            <th>阅读数</th>
                            <th>回答数</th>
                            <th>喜欢数</th>
                            <th>关注数</th>
                            <th style="width: 50px;">推荐</th>
                            <th>显示</th>
                            <th>发布时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <!--{loop $list $k1 $val}-->
                        <tr>
                            <td>
                                <form action="{eval echo site_url('community/information_setsort')}" method="post">
                                    <input type="hidden" name="id" value="{$val['id']}">
                                    <input type="text" name="sort" class="text" value="{$val['sort']}"
                                           style="width:20px;">
                                </form>
                            </td>
                            <td><a href="{$val['exposure_url']}" target="_blank">{$val['title']}</a></td>
                            <td>{$val['nickname']}</td>
                            <td>
                                <form action="{eval echo site_url('community/information_setreadnum')}" method="post">
                                    <input type="hidden" name="id" value="{$val['id']}">
                                    <input type="text" name="readnum" class="text" value="{$val['readnum']}"
                                           style="width:50px;">
                                </form>
                            </td>
                            <td>{$val['answernum']}</td>
                            <td>{$val['likes']}</td>
                            <td>{$val['focusnum']}</td>

                            <td>
                                <a title="<!--{if ($val['recommend'])==0 }-->点击推荐<!--{else}-->点击取消<!--{/if}-->"
                                   href="{eval echo site_url('community/information_setrecommend').'?id='.$val['id'].'&recommend='.abs(1-$val['recommend'])}"
                                   class="ajax-get"><!--{if ($val['recommend'])==0 }-->未推荐<!--{else}--><span
                                        style="color:#ff0000">已推荐</span><!--{/if}--></a>
                            </td>
                            <td>
                                <a title="<!--{if ($val['is_show'])==0 }-->点击显示<!--{else}-->点击隐藏<!--{/if}-->"
                                   href="{eval echo site_url('community/information_setshow').'?id='.$val['id'].'&is_show='.abs(1-$val['is_show'])}"
                                   class="ajax-get">{if ($val['is_show'])==0}隐藏{else}<span style="color:#ff0000">显示</span>{/if}</a>
                            </td>
                            <td>{$val['create_time']}</td>
                            <td>
                                <a title="编辑" href="{eval echo site_url('community/information_edit').'?id='.$val['id']}">编辑</a>
                                <a title="查看" href="{$val['information_url']}" target="_blank">查看</a>&nbsp;
                            </td>
                        </tr>
                        <!--{/loop}-->
                        </tbody>
                    </table>
                    <!-- 分页 -->
                    <div class="page">
                        <div>
                            {$showpage}
                            <span class="rows">共 {$Total} 条记录</span>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <script>
            $(function () {
                //搜索功能
                $("#search").click(function () {

                    var url = $(this).attr('url');
                    var award = $("#sch-sort-txt-award").attr("data");
                    var query = $('.search-form').find('input').serialize();
                    query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                    query = query.replace(/^&/g, '');
                    if (award != '') {
                        query += '&seach_type=' + award; //板块
                    }
                    if (url.indexOf('?') > 0) {
                        url += '&' + query;
                    } else {
                        url += '?' + query;
                    }
                    window.location.href = url;
                });

                /* 状态搜索子菜单 */

                $(".search-form").find(".drop-award").hover(function () {
                    $("#sub-sch-menu-award").removeClass("hidden");

                }, function () {
                    $("#sub-sch-menu-award").addClass("hidden");

                });
                $("#sub-sch-menu-award li").find("a").each(function () {
                    $(this).click(function () {
                        var text = $(this).text();
                        $("#sch-sort-txt-award").text(text).attr("data", $(this).attr("value"));
                        $("#sub-sch-menu-award").addClass("hidden");
                    })
                });
                //回车自动提交
                $('.search-form').find('input').keyup(function (event) {
                    if (event.keyCode === 13) {
                        $("#search").click();
                    }
                });
                /* 实时更新分类信息 */
                $(".tab-content").on("submit", "form", function () {
                    var self = $(this);
                    $.post(
                            self.attr("action"),
                            self.serialize(),
                            "json"
                    );
                    return false;
                }).on("focus", "input", function () {
                    $(this).data('param', $(this).closest("form").serialize());
                }).on("blur", "input", function () {
                    if ($(this).data('param') != $(this).closest("form").serialize()) {
                        $(this).closest("form").submit();
                    }
                });
            });
        </script>
        <!--F-->{load footer}